package com.jt.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//导入配置文件,之后由Spring容器扫描
@PropertySource(value = "classpath:/properties/image.properties",
		encoding = "utf-8")
public class FileController {

	//问题:如何将配置作为动态的获取?
	@Value("${image.localDir}") //sple表达式Spring框架所提供的
	private String localDir;

	@RequestMapping("/getPath")
	public String getPath() {
		System.out.println("指定图片的地址:" + localDir);
		return "图片的地址为:" + localDir;
	}
}
